package com.central.commons.exception;

public class CustomException extends RuntimeException {

    private static final long serialVersionUID = 3252934876928019115L;
    //异常错误编码
    private int code;
    //异常信息
    private String message;

    private CustomException() {
    }

    public CustomException(CustomExceptionType exceptionTypeEnum) {
        code = exceptionTypeEnum.getCode();
        message = exceptionTypeEnum.getDescription();
    }

    public CustomException(CustomExceptionType exceptionTypeEnum,
            String message) {
        code = exceptionTypeEnum.getCode();
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}